'''
Created on Feb 9, 2013

@author: Oberron
'''
import ical
import urllib
import json
import datetime

#sical = urllib.urlopen("http://ical2list.appspot.com/bastilleday.ics").read()
sical = open("C:/sw/icalculator/rsc/utest/test_vect/RFC5545/RFC5545_3.6.ics").read()
sical = open("C:/sw/icalculator/rsc/utest/test_vect/by_ferie.ics").read()
#print sical
mycal = ical.ics()
ver = mycal.version
mycal.ical_data = []
mycal.string_load(sical)
#mycal.local_load("C:/sw/icalculator/rsc/utest/test_vect/RFC5545/RFC5545_3.8.5.3_1.ics")
dates = mycal.get_event_instances("20080101","20130101")
print dates
print len(dates)
dthandler = lambda obj: obj.isoformat() if (isinstance(obj, datetime.datetime) or isinstance(obj, datetime.date)) else None
sdates = json.dumps(dates,default=dthandler)
print sdates
print len(sdates)
#print mycal.lSCM
#print mycal.dVCALENDAR
